home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / Workbench.mod < prev   
Text File  |  1995-06-29  |  9KB  |  309 lines

  1. (**************************************************************************
  2.  
  3.      $RCSfile: Workbench.mod $
  4.   Description: Interface to workbench.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.8 $
  8.       $Author: fjc $
  9.         $Date: 1995/06/04 23:13:14 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *>
  23.  
  24. MODULE [2] Workbench;
  25.  
  26. IMPORT
  27.   SYS := SYSTEM, Kernel, e := Exec, u := Utility, d := Dos, i := Intuition,
  28.   s := Sets;
  29.  
  30.  
  31. (* Pointers are declared first for convenience *)
  32.  
  33. TYPE
  34.  
  35.   OldDrawerDataPtr * = POINTER TO OldDrawerData;
  36.   DrawerDataPtr *    = POINTER TO DrawerData;
  37.   DiskObjectPtr *    = POINTER TO DiskObject;
  38.   FreeListPtr *      = POINTER TO FreeList;
  39.   AppMessagePtr *    = POINTER TO AppMessage;
  40.   WBStartupPtr *     = POINTER TO WBStartup;
  41.   WBArgPtr *         = POINTER TO WBArg;
  42.   AppWindowPtr *     = POINTER TO AppWindow;
  43.   AppIconPtr *       = POINTER TO AppIcon;
  44.   AppMenuItemPtr *   = POINTER TO AppMenuItem;
  45.  
  46.  
  47. (*
  48. **      $VER: startup.h 36.3 (11.7.90)
  49. **
  50. **      workbench startup definitions
  51. *)
  52.  
  53.  
  54. TYPE
  55.  
  56.   WBArg * = RECORD
  57.     lock * : d.FileLockPtr;      (* a lock descriptor *)
  58.     name * : e.LSTRPTR;          (* a string relative to that lock *)
  59.   END; (* WBArg *)
  60.  
  61.   WBArguments * = ARRAY MAX(INTEGER) OF WBArg;
  62.   WBArgumentsPtr * = POINTER TO WBArguments;
  63.  
  64.   WBStartup * = RECORD (e.MessageBase)
  65.     message *    : e.Message;      (* a standard message structure *)
  66.     process *    : d.ProcessId;    (* the process descriptor for you *)
  67.     segment *    : e.BPTR;         (* a descriptor for your code *)
  68.     numArgs *    : LONGINT;        (* the number of elements in ArgList *)
  69.     toolWindow * : e.LSTRPTR;      (* description of window *)
  70.     argList *    : WBArgumentsPtr; (* the arguments themselves *)
  71.   END; (* WBStartup *)
  72.  
  73.  
  74. (*
  75. **      $VER: workbench.h 40.1 (26.8.93)
  76. **
  77. **      workbench.library general definitions
  78. *)
  79.  
  80. CONST
  81.  
  82.   disk *      = 1;
  83.   drawer *    = 2;
  84.   tool *      = 3;
  85.   project *   = 4;
  86.   garbage *   = 5;
  87.   device *    = 6;
  88.   kick *      = 7;
  89.   wbAppIcon * = 8;
  90.  
  91. TYPE
  92.  
  93.   OldDrawerData * = RECORD (i.NewWindowBase) (* pre V36 definition *)
  94.     newWindow * : i.NewWindow; (* args to open window *)
  95.     currentX *  : LONGINT;     (* current x coordinate of origin *)
  96.     currentY *  : LONGINT;     (* current y coordinate of origin *)
  97.   END; (* OldDrawerData *)
  98.  
  99. CONST
  100.  
  101. (* the amount of DrawerData actually written to disk *)
  102.   oldDrawerDataFileSize * = SIZE (OldDrawerData);
  103.  
  104. TYPE
  105.  
  106.   DrawerData * = RECORD (i.NewWindowBase)
  107.     newWindow * : i.NewWindow; (* args to open window *)
  108.     currentX *  : LONGINT;     (* current x coordinate of origin *)
  109.     currentY *  : LONGINT;     (* current y coordinate of origin *)
  110.     flags *     : s.SET32;     (* flags for drawer *)
  111.     viewModes * : s.SET16;     (* view mode for drawer *)
  112.   END; (* DrawerData *)
  113.  
  114. CONST
  115.  
  116. (* the amount of DrawerData actually written to disk *)
  117.   drawerDataFileSize * = SIZE (DrawerData);
  118.  
  119. TYPE
  120.  
  121.   ToolTypePtr * = POINTER TO ARRAY MAX(INTEGER) OF e.LSTRPTR;
  122.  
  123.   DiskObject * = RECORD
  124.     magic *       : e.UWORD;  (* a magic number at the start of the file *)
  125.     version *     : e.UWORD;  (* a version number, so we can change it *)
  126.     gadget *      : i.Gadget; (* a copy of in core gadget *)
  127.     type *        : SHORTINT;
  128.     defaultTool * : e.LSTRPTR;
  129.     toolTypes *   : ToolTypePtr;
  130.     currentX *    : LONGINT;
  131.     currentY *    : LONGINT;
  132.     drawerData *  : DrawerDataPtr;
  133.     toolWindow *  : e.LSTRPTR; (* only applies to tools *)
  134.     stackSize *   : LONGINT;  (* only applies to tools *)
  135.   END; (* DiskObject *)
  136.  
  137. CONST
  138.  
  139.   diskMagic *    = -1CF0H;  (*0E310H*) (* a magic number, not easily impersonated *)
  140.   diskVersion *  = 1;       (* our current version number *)
  141.   diskRevision * = 1;       (* our current revision number *)
  142. (* I only use the lower 8 bits of Gadget.UserData for the revision # *)
  143.   diskRevisionMask * = 0FFH;
  144.  
  145. TYPE
  146.  
  147.   FreeList * = RECORD
  148.     numFree * : INTEGER;
  149.     memList * : e.List;
  150.   END; (* FreeList *)
  151.  
  152. CONST
  153.  
  154. (* workbench does different complement modes for its gadgets.
  155. ** It supports separate images, complement mode, and backfill mode.
  156. ** The first two are identical to intuitions GADGIMAGE and GADGHCOMP.
  157. ** backfill is similar to GADGHCOMP, but the region outside of the
  158. ** image (which normally would be color three when complemented)
  159. ** is flood-filled to color zero.
  160. *)
  161.   gadgBackFill * = {0};
  162.  
  163. (* if an icon does not really live anywhere, set its current position
  164. ** to here
  165. *)
  166.   noIconPosition * = 80000000H;
  167.  
  168. (* workbench now is a library.  this is it's name *)
  169.   workbenchName * = "workbench.library";
  170.  
  171. (* If you find amVersion >= amVERSION, you know this structure has
  172.  * at least the fields defined in this version of the include file
  173.  *)
  174.   amVersion * = 1;
  175.  
  176. TYPE
  177.  
  178.   AppMessage * = RECORD (e.MessageBase)
  179.     message *  : e.Message;          (* standard message structure *)
  180.     type *     : e.UWORD;            (* message type *)
  181.     userData * : LONGINT;            (* application specific *)
  182.     id *       : e.ULONG;            (* application definable ID *)
  183.     numArgs *  : LONGINT;            (* # of elements in arglist *)
  184.     argList *  : WBArgumentsPtr;     (* the arguements themselves *)
  185.     version *  : e.UWORD;            (* will be amVERSION *)
  186.     class *    : s.SET16;            (* message class *)
  187.     mouseX *   : INTEGER;            (* mouse x position of event *)
  188.     mouseY *   : INTEGER;            (* mouse y position of event *)
  189.     seconds *  : e.ULONG;            (* current system clock time *)
  190.     micros *   : e.ULONG;            (* current system clock time *)
  191.     reserved * : ARRAY 8 OF e.ULONG; (* avoid recompilation *)
  192.   END; (* AppMessage *)
  193.  
  194. CONST
  195.  
  196. (* types of app messages *)
  197.   appWindow *   = 7;  (* app window message    *)
  198.   appIcon *     = 8;  (* app icon message      *)
  199.   appMenuItem * = 9;  (* app menu item message *)
  200.  
  201. TYPE
  202.  
  203. (*
  204.  * The following structures are private.  These are just stub
  205.  * structures for code compatibility...
  206.  *)
  207.   AppWindow *   = RECORD END;
  208.   AppIcon *     = RECORD END;
  209.   AppMenuItem * = RECORD END;
  210.  
  211. (*-- Library Base variable --------------------------------------------*)
  212.  
  213. VAR
  214.  
  215.   base *  : e.LibraryPtr;
  216.  
  217.  
  218. (*-- Library Functions ------------------------------------------------*)
  219.  
  220. (*
  221. **      $VER: wb_protos.h 38.4 (31.5.92)
  222. *)
  223.  
  224. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  225.  
  226. PROCEDURE StartWorkbench* [base,-42]
  227.   ( flags [0] : s.SET32;
  228.     ptr   [1] : LONGINT)
  229.   : BOOLEAN;
  230. PROCEDURE AddAppWindowA* [base,-48]
  231.   ( id       [0] : e.ULONG;
  232.     userdata [1] : LONGINT;
  233.     window   [8] : i.WindowPtr;
  234.     msgport  [9] : e.MsgPortBasePtr;
  235.     taglist [10] : ARRAY OF u.TagItem )
  236.   : AppWindowPtr;
  237. PROCEDURE AddAppWindow* [base,-48]
  238.   ( id       [0]   : e.ULONG;
  239.     userdata [1]   : LONGINT;
  240.     window   [8]   : i.WindowPtr;
  241.     msgport  [9]   : e.MsgPortBasePtr;
  242.     taglist [10].. : u.Tag )
  243.   : AppWindowPtr;
  244. PROCEDURE RemoveAppWindow* [base,-54]
  245.   ( appWindow [8] : AppWindowPtr )
  246.   : BOOLEAN;
  247. PROCEDURE AddAppIconA* [base,-60]
  248.   ( id       [0] : e.ULONG;
  249.     userdata [1] : LONGINT;
  250.     text     [8] : ARRAY OF CHAR;
  251.     msgport  [9] : e.MsgPortBasePtr;
  252.     lock    [10] : d.FileLockPtr;
  253.     diskobj [11] : DiskObjectPtr;
  254.     taglist [12] : ARRAY OF u.TagItem )
  255.   : AppIconPtr;
  256. PROCEDURE AddAppIcon* [base,-60]
  257.   ( id       [0]  : e.ULONG;
  258.     userdata [1]  : LONGINT;
  259.     text     [8]  : ARRAY OF CHAR;
  260.     msgport  [9]  : e.MsgPortBasePtr;
  261.     lock    [10]  : d.FileLockPtr;
  262.     diskobj [11]  : DiskObjectPtr;
  263.     taglist [12]..: u.Tag )
  264.   : AppIconPtr;
  265. PROCEDURE RemoveAppIcon* [base,-66]
  266.   ( appIcon [8] : AppIconPtr )
  267.   : BOOLEAN;
  268. PROCEDURE AddAppMenuItemA* [base,-72]
  269.   ( id       [0] : e.ULONG;
  270.     userdata [1] : LONGINT;
  271.     text     [8] : ARRAY OF CHAR;
  272.     msgport  [9] : e.MsgPortBasePtr;
  273.     taglist [10] : ARRAY OF u.TagItem )
  274.   : AppMenuItemPtr;
  275. PROCEDURE AddAppMenuItem* [base,-72]
  276.   ( id       [0]   : e.ULONG;
  277.     userdata [1]   : LONGINT;
  278.     text     [8]   : ARRAY OF CHAR;
  279.     msgport  [9]   : e.MsgPortPtr;
  280.     taglist [10].. : u.Tag )
  281.   : AppMenuItemPtr;
  282. PROCEDURE RemoveAppMenuItem* [base,-78]
  283.   ( appMenuItem [8] : AppMenuItemPtr )
  284.   : BOOLEAN;
  285.  
  286. (*--- functions in V39 or higher (Release 3) ---*)
  287.  
  288. PROCEDURE WBInfo* [base,-90]
  289.   ( lock    [8] : d.FileLockPtr;
  290.     name    [9] : ARRAY OF CHAR;
  291.     screen [10] : i.ScreenPtr );
  292.  
  293.  
  294. (*-- Library Base variable --------------------------------------------*)
  295.  
  296. <*$LongVars-*>
  297.  
  298. (*-----------------------------------*)
  299. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  300.  
  301. BEGIN (* CloseLib *)
  302.   IF base # NIL THEN e.CloseLibrary (base) END;
  303. END CloseLib;
  304.  
  305. BEGIN
  306.   base := e.OpenLibrary (workbenchName, e.libraryMinimum);
  307.   IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
  308. END Workbench.
  309.